libxc: introduce xc_dom_seg_to_ptr_pages
authorIan Jackson <ian.jackson@eu.citrix.com>
Fri, 14 Jun 2013 15:39:34 +0000 (16:39 +0100)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Fri, 14 Jun 2013 15:39:34 +0000 (16:39 +0100)
commit53bfcf585b09eb4ac2240f89d1ade77421cd2451
tree018efe3f5abe927fbcd1d1f00fcc19903f148d5c
parent14573b974850d82de7aebad17e6471d27d847f2c
libxc: introduce xc_dom_seg_to_ptr_pages

Provide a version of xc_dom_seg_to_ptr which returns the number of
guest pages it has actually mapped.  This is useful for callers who
want to do range checking; we will use this later in this series.

This is part of the fix to a security issue, XSA-55.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Reviewed-by: Chuck Anderson <chuck.anderson@oracle.com>
v7: xc_dom_seg_to_ptr_pages now always expects pages_out!=NULL.
   (It seems silly to have it tolerate NULL when all the real callers
    pass non-NULL and there's a version which doesn't need pages_out
    anyway.  Fix the call in xc_dom_seg_to_ptr to have a dummy pages
    for pages_out.)

v5: xc_dom_seg_to_ptr_pages sets *pages_out=0 if it returns NULL.

v4 was:

Acked-by: Ian Campbell <ian.campbell@citrix.com>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
tools/libxc/xc_dom.h